package top.guinguo.poker;

import java.util.ArrayList;
import java.util.List;

public class Player {
    /**
     * 名字
     */
    private String name;

    /**
     * 是否为庄家
     */
    private boolean isMaster;

    /**
     * 扑克牌
     */
    private List<Poker> pokers;

    /**
     * 点数
     */
    private double pokerPoint= 0.0;

    /**
     * 下注大小
     */
    private int bet;

    public Player(String name, boolean isMaster) {
        this.isMaster = isMaster;
        this.name = name;
        this.pokers = new ArrayList<Poker>(5);//一位玩家最多也就5张牌
    }

    /**
     * 获取手牌数量
     */
    public int getPokerCount() {
        return pokers.size();
    }

    /**
     * 要牌
     */
    public void addPoker(Poker poker) {
        this.pokers.add(poker);
        this.pokerPoint += poker.getPoint();
    }

    /**
     * 获取玩家点数
     */
    public double getPokerPoint() {
        return pokerPoint;
    }

    public String getPokerList() {
        String pl = "【"+this.pokerPoint+"】[ ";
        for (Poker p : this.pokers) {
            pl += p.getPoint()+"，";
        }
        pl = pl.substring(0, pl.length());
        pl += "]";
        return pl;
    }

    public int getBet() {
        return bet;
    }

    public void setBet(int bet) {
        this.bet = bet;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public boolean isMaster() {
        return isMaster;
    }

    public void setIsMaster(boolean isMaster) {
        this.isMaster = isMaster;
    }

    public List<Poker> getPokers() {
        return pokers;
    }

    public void setPokers(List<Poker> pokers) {
        this.pokers = pokers;
    }
}
